package day6;

import java.util.Scanner;

// https://www.nowcoder.com/questionTerminal/0c630b57e3d144379508d63d8eb65854
public class code1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        int flag = 1;
        long ans = 0;
        if(str == null || str == "" || str.charAt(0) == '0') {
            System.out.println("0");
            return;
        }
        if(str.charAt(0) == '-') {
            if(str.charAt(1) == '0') {
                System.out.println("0");
                return;
            }
            flag = -1;
            for (int i = 1;i < str.length();i++) {
                if(str.charAt(i) < '0' || str.charAt(i) > '9') {
                    System.out.println("0");
                    return;
                }
                ans = ans * 10 + (str.charAt(i) - '0');
            }
            ans = ans * flag;
        }else {
            for (int i = 0;i < str.length();i++) {
                if(str.charAt(i) < '0' || str.charAt(i) > '9') {
                    System.out.println("0");
                    return;
                }
                ans = ans * 10 + (str.charAt(i) - '0');
            }
        }
        if (ans > Integer.MAX_VALUE || ans < Integer.MIN_VALUE) {
            System.out.println("0");
        }else {
            System.out.println(ans);
        }

    }
}
